<?php

namespace App\http\Models;

use Illuminate\Database\Eloquent\Model;
use DB;
use Log;

class Videos extends Model
{
    /**
     * 查询视频的列表
     * @return array
     */
    public function getAllVideos()
    {
        try {
            $videos = DB::table('videos')
                ->get();
            return $videos;
        } catch (Exception $e) {
            Log::info($e->getMessage());
        }
    }

    /**
     * 根据id获取视频详情
     * @param $vid
     * @return mixed
     */
    public function getVideosById($vid)
    {
        try {
            $videos = DB::table('videos')
                ->where('video_id','=',$vid)
                ->first();
            return $videos;
        } catch (Exception $e) {
            Log::info($e->getMessage());
        }
    }
}